/***********************************************************
* 
*     File Name:  identity.cpp
* 
*        Author:  Algolc
* 
*          mail:  17360224@qq.com
* 
*  Created Time:  Fri 13 Jul 2018 09:45:10 AM CST
* 
***********************************************************/

#include "zhelpers.h"
int main() {
    void* context = zmq_ctx_new();

    void* sink = zmq_socket(context, ZMQ_ROUTER);
    zmq_bind(sink, "inproc://example");

    void *amonymous = zmq_socket(context, ZMQ_REQ);
    zmq_connect(amonymous, "inproc://example");
    s_send(amonymous, "ROUTER socket uses a generated UUID");
    s_dump(sink);

    void* identified = zmq_socket(context, ZMQ_REQ);
    zmq_setsockopt(identified, ZMQ_IDENTITY, "eatShit", 5);
    zmq_connect(identified, "inproc://example");
    s_send(identified, "ROUTER socket uses REQ's scoket identity");
    s_dump(sink);

    zmq_close(sink);
    zmq_close(amonymous);
    zmq_close(identified);
    zmq_ctx_destroy(context);

    return 0;
}
